var e = require;
var t = module;
var o = exports;
(o.__esModule = !0), (o.default = void 0);
var n = (function () {
    function e() {
        (this.mAutoCloseTimeout = 0),
            (this.autoCloseInterval = null),
            (this.hideShareClose = 0),
            (this.videoAd = null),
            (this.bannerAd = null),
            (this.yuanshengIndex = 0),
            (this.yuanshengADK = null),
            (this.yuanshengADBanner = null);
    }
    var t = e.prototype;
    return (
        (t.closeToYou = function () {
            this.yuanshengADK && this.yuanshengADK.destroy(),
                this.yuanshengADBanner && this.yuanshengADBanner.destroy();
        }),
        (t.createChaping = function (e, t, o) {
            var n =
                    e.imgUrlList && e.imgUrlList[0]
                        ? e.imgUrlList[0]
                        : e.iconUrlList && e.iconUrlList[0]
                        ? e.iconUrlList[0]
                        : null,
                i = e.source,
                a = e.title,
                r = new Laya.Box();
            (r.left = -10), (r.right = -10), (r.top = -10), (r.bottom = -10), (r.zOrder = 1e4), Laya.stage.addChild(r);
            var s = new Laya.Image("res/ysguanggao/native_2.png");
            (s.left = -10),
                (s.right = -10),
                (s.top = -10),
                (s.bottom = -10),
                (s.alpha = 0.7),
                r.addChild(s),
                s.on("click", this, function () {});
            var d = new Laya.Image(n);
            (d.centerX = 0), (d.centerY = 0), (d.width = 360), (d.height = 240);
            var c = (Laya.stage.width - 50) / d.width;
            (d.scaleX = c), (d.scaleY = c), r.addChild(d);
            var l = function () {
                o && o(), r.destroy(), console.log("ad click");
            }.bind(this);
            d.on("click", this, l);
            var h = new Laya.Image("res/ysguanggao/native_1.png");
            (h.anchorX = 1), (h.anchorY = 1), (h.centerX = 150 * c), (h.centerY = 110 * c), r.addChild(h);
            var u = new Laya.Image("res/ysguanggao/native_3.png");
            (u.scaleX = lplatform.cparam.closeBtnScale || 1),
                (u.scaleY = lplatform.cparam.closeBtnScale || 1),
                lplatform.cparam.closeBtnScale < 1
                    ? ((u.centerX = 170 * c), (u.centerY = -110 * c))
                    : ((u.centerX = 170 * c), (u.centerY = -140 * c)),
                (u.width = 58),
                (u.height = 58),
                r.addChild(u),
                u.on("click", this, function () {
                    console.log("ad close"), t && t(), r.destroy();
                });
            var p = new Laya.Image("res/ysguanggao/native_3.png");
            (p.centerX = u.centerX),
                (p.centerY = u.centerY),
                (p.width = u.width),
                (p.height = u.height),
                (p.scaleX = 1),
                (p.scaleY = 1),
                r.addChild(p);
            var f;
            f = e.clickBtnTxt.indexOf("下载") >= 0 ? "res/ysguanggao/xiazaibg.png" : "res/ysguanggao/dakaibg.png";
            var m = new Laya.Image(f);
            (m.centerX = 0 * c), (m.centerY = 140 * c), m.on("click", this, l), r.addChild(m);
            var g = new Laya.Label(i || "");
            (g.fontSize = 30), (g.centerX = -110 * c), (g.centerY = 110 * c), r.addChild(g);
            var w = new Laya.Label(a || "");
            return (
                (w.fontSize = 30),
                (w.centerX = 0 * c),
                (w.centerY = -130 * c),
                r.addChild(w),
                (r.alpha = 0),
                new Laya.Tween().to(r, {alpha: 1}, 500, Laya.Ease.backOut),
                r
            );
        }),
        (t.createBanner = function (e, t, o) {
            var n = e.imgUrlList[0],
                i = e.source,
                a = e.title,
                r = new Laya.Sprite();
            (r.width = r.height = 0), (r.zOrder = 1e4), Laya.stage.addChild(r), Laya.stage.width;
            var s = new Laya.Image(n);
            (s.width = Laya.stage.width - 20),
                (s.height = 240),
                (s.x = 10),
                (s.y = Laya.stage.height - s.height + 0),
                r.addChild(s);
            var d = function () {
                console.log("ad click"), o && o(), r.destroy();
            }.bind(this);
            s.on("click", this, d);
            var c = new Laya.Image("res/ysguanggao/native_1.png");
            (c.width = 83), (c.height = 31), (c.x = s.width - c.width), (c.y = s.height - c.height), s.addChild(c);
            var l = new Laya.Image("res/ysguanggao/native_3.png");
            (l.width = 38),
                (l.height = 38),
                (l.x = s.width - l.width - 5),
                (l.y = 5),
                (l.scaleX = lplatform.cparam.closeBtnScale || 1),
                (l.scaleY = lplatform.cparam.closeBtnScale || 1),
                s.addChild(l),
                l.on("click", this, function () {
                    console.log("ad close"), t && t(), r.destroy();
                });
            var h = new Laya.Image("res/ysguanggao/native_3.png");
            (h.width = l.width), (h.height = l.height), (h.x = l.centerX), (h.y = l.centerY), s.addChild(h);
            var u;
            u = e.clickBtnTxt.indexOf("下载") >= 0 ? "res/ysguanggao/xiazaibg.png" : "res/ysguanggao/dakaibg.png";
            var p = new Laya.Image(u);
            if (
                ((p.width = 200),
                (p.height = 70),
                (p.x = s.width / 2 - p.width / 2),
                (p.y = -p.height - 20),
                p.on("click", this, d),
                s.addChild(p),
                i)
            ) {
                var f = new Laya.Label(i);
                (f.fontSize = 25), (f.bgColor = "#ffffffff"), (f.x = 0), (f.y = s.height - f.height), s.addChild(f);
            }
            if (a) {
                var m = new Laya.Label(a);
                (m.fontSize = 25),
                    (m.bgColor = "#ffffffff"),
                    (m.x = s.width / 2 - m.width / 2),
                    (m.y = 0),
                    s.addChild(m);
            }
            return (r.alpha = 0), new Laya.Tween().to(r, {alpha: 1}, 500, Laya.Ease.backOut), r;
        }),
        (t.CreateShareK = function (e, t, o, n, i) {
            void 0 === n && (n = 0), void 0 === i && (i = !1);
            var a = new Laya.Box();
            (a.left = -10), (a.right = -10), (a.top = -10), (a.bottom = -10), (a.zOrder = 1e4), Laya.stage.addChild(a);
            var r = new Laya.Image("fenxiang/mask.png");
            (r.left = -10),
                (r.right = -10),
                (r.top = -10),
                (r.bottom = -10),
                (r.alpha = 0.4),
                a.addChild(r),
                r.on("click", this, function () {});
            var s = new Laya.Image("fenxiang/share.png");
            (s.centerX = 0), (s.centerY = 0), a.addChild(s);
            var d = new Laya.Image("fenxiang/queding.png");
            (d.centerX = 0),
                (d.centerY = 270),
                a.addChild(d),
                d.on("click", this, function () {
                    e && e(), a.destroy();
                });
            var c = new Laya.Image("fenxiang/close.png");
            info.windowWidth > info.windowHeight
                ? ((c.centerX = -310), (c.centerY = -195))
                : ((c.centerX = -195), (c.centerY = -310)),
                a.addChild(c),
                c.on("click", this, function () {
                    console.log("closeBtn click"),
                        t && t(),
                        this.autoCloseInterval && clearInterval(this.autoCloseInterval),
                        a.destroy();
                });
            var l = Math.random();
            if (
                (lplatform.cparam.hideShareClose && l <= lplatform.cparam.hideShareClose
                    ? (c.visible = !1)
                    : ((c.scaleX = 0),
                      (c.scaleY = 0),
                      new Laya.Tween().to(c, {scaleX: 1, scaleY: 1}, 300, Laya.Ease.backOut, null, 1e3)),
                (a.alpha = 0),
                new Laya.Tween().to(a, {alpha: 1}, 500, Laya.Ease.backOut),
                i && "ios" !== lplatform.systemInfo.platform)
            ) {
                var h = new Laya.Image("fenxiang/adlist" + Math.floor(4 * Math.random()) + ".png");
                (h.x = 0),
                    (h.y = 0),
                    a.addChild(h),
                    h.on(Laya.Event.CLICK, this, function () {
                        lplatform.goToGameOrGameList(null);
                    }),
                    (this.zuo = function () {
                        new Laya.Tween().to(
                            h,
                            {x: Laya.stage.width - 1e3},
                            3e3,
                            null,
                            Laya.Handler.create(this, function () {
                                this.you();
                            })
                        );
                    }.bind(this)),
                    (this.you = function () {
                        new Laya.Tween().to(
                            h,
                            {x: 0},
                            3e3,
                            null,
                            Laya.Handler.create(this, function () {
                                this.zuo();
                            })
                        );
                    }.bind(this)),
                    this.zuo();
            }
            return a;
        }),
        (t.getCanvas = function () {
            return Laya.Render.canvas;
        }),
        e
    );
})();
(o.default = n), (t.exports = o.default);
